<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="f(key, values)">click</button>
<script>
    var key = "aaa.bbb.ccc.ddd.eee"
    var values = 111.222

    function f(key, value) {
        console.log(value)
        debugger
        var result = {}
        var arr = key.split('.')
        var r
        while (r = arr.pop()) {
            result = {}
            result[r] = value
            value = result
        }

        console.log(result)
        return result
    }
</script>
</body>
</html>
